FILTERS=position.o radius.o duplicate.o arcdist.o polygon.o smplrout.o \
reverse_route.o sort.o stackfilter.o trackfilter.o discard.o \
- nukedata.o interpolate.o transform.o height.o
+ nukedata.o interpolate.o transform.o height.o swapdata.o
JEEPS=jeeps/gpsapp.o jeeps/gpscom.o \
jeeps/gpsmath.o jeeps/gpsmem.o \
stmwpp.o: stmwpp.c defs.h config.h queue.h gbtypes.h zlib/zlib.h \
zlib/zconf.h gbfile.h cet.h cet_util.h inifile.h session.h csv_util.h
strptime.o: strptime.c strptime.h
+swapdata.o: swapdata.c defs.h config.h queue.h gbtypes.h zlib/zlib.h \
+ zlib/zconf.h gbfile.h cet.h cet_util.h inifile.h session.h filterdefs.h
tef_xml.o: tef_xml.c defs.h config.h queue.h gbtypes.h zlib/zlib.h \
zlib/zconf.h gbfile.h cet.h cet_util.h inifile.h session.h xmlgeneric.h
text.o: text.c defs.h config.h queue.h gbtypes.h zlib/zlib.h zlib/zconf.h \
extern filter_vecs_t interpolatefilt_vecs;
extern filter_vecs_t transform_vecs;
extern filter_vecs_t height_vecs;
+extern filter_vecs_t swapdata_vecs;
static
fl_vecs_t filter_vec_list[] = {
"height",
"Manipulate altitudes"
},
+ {
+ &swapdata_vecs,
+ "swap",
+ "Swap latitude and longitude of all loaded points"
+ },
#endif
{
--- /dev/null
+/*
+
+ Swap data filter
+
+ Copyright (C) 2008 Olaf Klein, o.b.klein@gpsbabel.org
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA
+
+ */
+
+#include "defs.h"
+#include "filterdefs.h"
+#include <ctype.h>
+
+#define MYNAME "swapdata"
+
+#if FILTERS_ENABLED
+
+static
+arglist_t swapdata_args[] = {
+ ARG_TERMINATOR
+};
+
+static void
+swapdata_cb(const waypoint *ref)
+{
+ waypoint *wpt = (waypoint *)ref;
+ double x;
+
+ x = wpt->latitude;
+ wpt->latitude = wpt->longitude;
+ wpt->longitude = x;
+
+ return;
+}
+
+/*******************************************************************************
+* %%% global callbacks called by gpsbabel main process %%% *
+*******************************************************************************/
+
+static void
+swapdata_process(void) /* this procedure must be present in vecs */
+{
+ waypt_disp_all(swapdata_cb);
+ route_disp_all(NULL, NULL, swapdata_cb);
+ track_disp_all(NULL, NULL, swapdata_cb);
+}
+
+/*******************************************************************************/
+
+filter_vecs_t swapdata_vecs = {
+ NULL,
+ swapdata_process,
+ NULL,
+ NULL,
+ swapdata_args
+};
+
+/*******************************************************************************/
+#endif // FILTERS_ENABLED